
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 2
 * @Author : WangRuoyu 
 * @Date : 2023/5/15 9:32
 */

#include "iostream"
#include "algorithm"

using namespace std;

struct da {
    int id;
    int start;
    int over;
};

bool cmp(da d1, da d2) {
    return d1.start == d2.start ? d1.over < d2.over : d1.start < d2.start;
}

int main() {
    int n, k;
    cin >> n >> k;

    int keys[n + 1];
    int retime[n + 1];
    for (int i = 0; i <= n; ++i) {
        keys[i] = i;
        retime[i] = -1;
    }

    da ds[k];
    int minTime = 20000;
    int maxTime = 0;
    for (int i = 0; i < k; ++i) {
        int len;
        cin >> ds[i].id >> ds[i].start >> len;
        ds[i].over = ds[i].start + len;
        minTime = min(minTime, ds[i].start);
        maxTime = max(maxTime, ds[i].over);
    }

    sort(ds, ds + k, cmp);

    int x = 0;
    for (int t = minTime; t <= maxTime; ++t) {
        for (int i = 1; i <= n; ++i) {
            if (retime[i] == t) {
                retime[i] = -1;
                for (int j = 1; j <= n; ++j) {
                    if (keys[j] == -1) {
                        keys[j] = i;
                        break;
                    }
                }
            }
        }
        for (; x <= k; ++x) {
            if (ds[x].start > t) {
                break;
            } else if (ds[x].start == t) {
                for (int i = 1; i <= n; ++i) {
                    if (keys[i] == ds[x].id) {
                        keys[i] = -1;
                        break;
                    }
                }
                retime[ds[x].id] = ds[x].over;
            }
        }
    }

    for (int i = 1; i <= n; ++i) {
        cout << keys[i] << " ";
    }

    return 0;
}